
import { IsString, IsNumber, IsBoolean, IsDate, IsOptional, IsEnum } from 'class-validator';
import { ApiProperty, OmitType, IntersectionType } from '@nestjs/swagger';
import { PagingDto } from 'src/common/dto/index';
import { CharEnum } from 'src/common/enum/index';
import {Column} from "typeorm";


export class BaseSurveyDto{
    @ApiProperty({required: false , description: '问卷ID'})
    @IsOptional()
    @IsNumber()
    surId?: number;

    @ApiProperty({enum: CharEnum, required: false , description: '删除标志'})
    @IsOptional()
    @IsString()
    delFlag?: string;

    @ApiProperty({enum: CharEnum, required: false , description: '状态'})
    @IsOptional()
    @IsString()
    status?: string;

    @ApiProperty({required: false , description: '创建者'})
    @IsOptional()
    @IsString()
    createBy?: string;

    @ApiProperty({required: false , description: '创建时间'})
    @IsOptional()
    @IsString()
    createTime?: string;

    @ApiProperty({required: false , description: '更新者'})
    @IsOptional()
    @IsString()
    updateBy?: string;

    @ApiProperty({required: false , description: '更新时间'})
    @IsOptional()
    @IsString()
    updateTime?: string;

    @ApiProperty({required: false , description: '备注'})
    @IsOptional()
    @IsString()
    remark?: string;

    @ApiProperty({required: false , description: '问卷状态'})
    @IsOptional()
    @IsString()
    state?: string;

    @ApiProperty({required: false , description: '模板名称'})
    @IsOptional()
    @IsString()
    tempName?: string;

    @ApiProperty({required: false , description: '问卷名称'})
    @IsOptional()
    @IsString()
    surName?: string;

    @ApiProperty({required: false , description: '问卷描述'})
    @IsOptional()
    @IsString()
    surDesc?: string;

    @ApiProperty({required: false , description: '标题颜色'})
    @IsOptional()
    @IsString()
    nameColor?: string;

    @ApiProperty({required: false , description: '描述颜色'})
    @IsOptional()
    @IsString()
    descColor?: string;

    @ApiProperty({required: false , description: '结束反馈语'})
    @IsOptional()
    @IsString()
    surFinish?: string;

    @ApiProperty({required: false , description: '开始时间'})
    @IsOptional()
    @IsString()
    startTime?: string;

    @ApiProperty({required: false , description: '结束时间'})
    @IsOptional()
    @IsString()
    endTime?: string;

    @ApiProperty({required: false , description: '显示分数'})
    @IsOptional()
    @IsString()
    showScore?: string;

    @ApiProperty({required: false , description: '是否作为模板'})
    @IsOptional()
    @IsString()
    isTemplate?: string;

    @ApiProperty({required: false , description: '顶部图片'})
    @IsOptional()
    @IsString()
    topImg?: string;

    @ApiProperty({required: false , description: '背景图片'})
    @IsOptional()
    @IsString()
    bgImg?: string;

    @ApiProperty({required: false , description: '背景图颜色'})
    @IsOptional()
    @IsString()
    bgColor?: string;

    @ApiProperty({required: false , description: '显示问卷标题'})
    @IsOptional()
    @IsString()
    showTitle?: string;

    @ApiProperty({required: false , description: '显示题目类型'})
    @IsOptional()
    @IsString()
    public showType: string;

    @ApiProperty({required: false , description: '显示题号'})
    @IsOptional()
    @IsString()
    showDesc?: string;

    @ApiProperty({required: false , description: '问卷类型'})
    @IsOptional()
    @IsString()
    surType?: string;

    @ApiProperty({required: true , description: '是否公开'})
    @IsString()
    @IsOptional()
    isPublic: string;

    @ApiProperty({required: true , description: '参与用户列表'})
    @IsOptional()
    joinUserList:number[];

    @ApiProperty({required: true , description: '点击提交后是否可以再次参与'})
    @IsString()
    @IsOptional()
    repeatJoin: string;

    @ApiProperty({required: true , description: '封面图片'})
    @IsString()
    @IsOptional()
    coverImg: string;

}

export class CreateSurveyDto extends OmitType(BaseSurveyDto, [ 'surId', 'delFlag', 'createBy', 'createTime']){}

export class UpdateSurveyDto extends OmitType(BaseSurveyDto, [ 'delFlag', 'createBy', 'createTime']){}

export class QuerySurveyDto extends IntersectionType( BaseSurveyDto, PagingDto){}

export class ListSurveyDto  extends OmitType(BaseSurveyDto, [ 'delFlag', 'createBy', 'createTime', 'updateBy', 'updateTime']) {}
